<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
#parse("/linkandscript.html")
<title>论坛控 $totalNewImageCount</title>
</head>
<body>
<!--
#parse("/boardcastemb.html")
-->
#parse("/feedbackemb.html")
#parse("/settingemb.html")
#parse("/indexheader.html")

  
<div id="forumsdiv">
    <table id="forumstable" class="center">
          #set($i = 0)
          #foreach($forumitem in $allforum ) 
          #set($i = $i+1)
          <tr>
          	#if($forumitem.getNewimagecount() > 0)
          	<td class="forumnum $forumitem.getGroups() $forumitem.getSite().getSitename() hasnewimage" forum="$forumitem.getId()">$i.</td>
            #else
            <td class="forumnum $forumitem.getGroups() $forumitem.getSite().getSitename()" forum="$forumitem.getId()">$i.</td>
            #end
            <td style="position:relative;" title="$forumitem.getId()">
            	<span style="font-size:18px;">$forumitem.getSite().getSitename()-$forumitem.getName()</span>
            	<a id="settingbtn$forumitem.getId()" class="settingbtn forumoperation" forum="$forumitem.getId()" 
                	href="/hezi/forum?forum=$forumitem.getId()&action=edit" target="_blank" >设置</a>
                <a id="deletebtn$forumitem.getId()" class="deletebtn forumoperation" forum="$forumitem.getId()">删除</a>
                <a id="viewbtn$forumitem.getId()" class="viewbtn forumoperation" forum="$forumitem.getId()" >看图</a>
                
                #if($forumitem.getSite().isNeedShowLogin())

                <a id="loginbtn$forumitem.getId()" class="loginbtn forumoperation" forum="$forumitem.getId()">登录</a>
                
                <div class="logindiv">
                	<span style="display:none;">扫描"$forumitem.getSite().getSitename()"需要您先登录</span>
                	<table class="logintable" style="width:100%">
                        <tr>
                        	<td style="text-align:right; font-size:12px; ">用户名</td>
                            <td>
                            	<input type="text" class="username" style="width:100px; padding:0px 3px;" value="">
                            </td>
                        </tr>
                        <tr>
                        	<td style="text-align:right; font-size:12px;">密码</td>
                            <td>
                            	<input type="text" class="password" style="width:100px; padding:0px 3px;" value="">
                            </td>
                        </tr>
                    </table>
                    <a id="loginsubmitbtn$forumitem.getId()" class="btn btn-info loginsubmitbtn" forum="$forumitem.getId()" site="$forumitem.getSite().getId()" >提交</a>
                </div>
                #end

                <a id="scanbtn$forumitem.getId()" class="scanbtn forumoperation" forum="$forumitem.getId()" site="$forumitem.getSite().getId()" isNeedLoginBeforeScan="$forumitem.getSite().isNeedLoginBeforeScan()">扫描</a>
            </td>
            <td width="10px" style="display:none">$forumitem.getPriority()</td>
            <td width="100px"><span>$forumitem.getGroups()</span></td>
            <td width="20px"><span title="新图片数">$forumitem.getNewimagecount()<span></td>
            <td width="100px" style="text-align:right"><span>$forumitem.getLastscantimeHuman()</span></td>
          </tr>
          #end<!--end of forum--> 
        </table>
</div>


<div id="footer" style="position:fixed; bottom:0px; right:10%; background:#FFF; padding:10px 4px;">
        <a id="scanallbtn" class="batchscan btn btn-info batchoperation" style="margin:4px;" >批量扫描<span class="forumcount"></span>个论坛</a>
        
        <span style="font-size:20px; color:#999; margin-right:10px;" class="batchoperation">扫描到第<input id="listpagestopindex" type="text" oldvalue="$listpagestopindex" value="$listpagestopindex" placeholder="Inactive" style="width:20px; padding:0px 3px; margin-top:4px;">页</span>
        
        <a id="viewallimagebtn" class="batchview btn btn-info batchoperation" style="margin:4px;" >批量看图<span class="forumcount"></span>个论坛</a>
<div>
    

</body>


<script language="javascript">
var currforum;
$(function(){
	$("#allsite").click(function(){
		$("td.forumnum").addClass("forumselected");
		$(".forumcount").html($(".forumselected").size());
		$(".batchoperation").show();
	});
	
	$("#hasnewimage").click(function(){
		$("td.hasnewimage").addClass("forumselected");
		$(".forumcount").html($(".forumselected").size());
		$(".batchoperation").show();
	});
	
	
	
	
	$(".batchscan").click(function(){
		var forumlist = "";
		var count=0
		$("td.forumselected").each(function(){
			forumlist = forumlist + $(this).attr("forum")+",";
			count++;
		});
		console.log(forumlist)
		  
		window.location.href="/hezi/scan?forum="+forumlist;	
	});
	
	$(".batchview").click(function(){
		var forumlist = "";
		var count=0
		$("td.forumselected").each(function(){
			forumlist = forumlist + $(this).attr("forum")+",";
			count++;
		});
		console.log(forumlist)
		
		window.location.href="/hezi/picwall?forum="+forumlist+"&windowwidth="+$(window).width();			
	});		
	
	
	
	$(".forumoperation").hide();
	$(".batchoperation").hide();
	

	$(".scanbtn").click(function(){
		
		var theforum = $(this).attr("forum");
		var site = $(this).attr("site");
		//window.location.href="/hezi/scan?forum="+theforum+"&windowwidth="+$(window).width();	
		//window.open("/hezi/scan?forum="+theforum+"&windowwidth="+$(window).width());
		
		if($(this).attr("isNeedLoginBeforeScan") == "true"){
			//consolelog("need login");
			window.location.href="/hezi/site?action=login&site="+site+"&next=scan&forum="+theforum+"&msg=扫描过程需要您提供此论坛的用户名和密码";	
			//$(this).parent().find(".logindiv").slideToggle();
			
		}
		else{
			//consolelog("go scan");
			//window.open("/hezi/scan?forum="+theforum+"&windowwidth="+$(window).width());
			window.location.href="/hezi/scan?forum="+theforum+"&windowwidth="+$(window).width();	
		}	
	});
	
	$(".loginbtn").click(function(){
		var isLoginSucc = $(this).attr("login");
		//consolelog(isLoginSucc);
		if(isLoginSucc == 'true'){
			//consolelog("当前为已登录状态");
			$(this).parent().find(".logindiv").slideToggle();
		}
		else{
			$(this).parent().find(".logindiv").slideToggle();
		}
	});
	
	$(".loginsubmitbtn").click(function(){
		var currforum = $(this).attr("forum");
		var site = $(this).attr("site");
		var username = $(this).parent().find(".username").val();
		var password = $(this).parent().find(".password").val();
		$(this).parent().slideToggle();
		$.get('/hezi/site?action=loginsubmit&site='+site+'&username='+username+'&password='+password,function(theback)
			  {
				console.log("back:" + theback);
				data = $.parseJSON(theback); 
				
				console.log(data.id);
				console.log(data.code);
				if(data.code == 'ok'){
					consolelog("登录成功");
					setTimeout('gotoIndex()',500);
				}
				else{
					consolelog("登录失败");
				}
			  }
		);	
		
		
	});
	
	
	$("#forumstable tr").hover(
		function(){
			tr = $(this);
			tr.find(".forumoperation").toggle();
        },
		function(){
			tr = $(this);
			tr.find(".forumoperation").toggle();
        }
    );
	
	$("#forumstable td.forumnum").click(function(){
		if( $(this).hasClass("forumselected") ){
			$(this).removeClass("forumselected");
		}
		else{
			$(this).addClass("forumselected");
		}
		
		//consolelog($(".forumselected").size());
		$(".forumcount").html($(".forumselected").size());
		
		if($(".forumselected").size() > 0){
			$(".batchoperation").show();
		}
		else{
			$(".batchoperation").hide();
		}
	});
	
	
	

	
	$(".viewbtn").click(function(){
		var theforum = $(this).attr("forum");
		window.open("/hezi/picwall?forum="+theforum+"&windowwidth="+$(window).width());
		//window.location.href="/hezi/picwall?forum="+theforum+"&windowwidth="+$(window).width();
	});
	
	$(".deletebtn").click(function(){
		var theforum = $(this).attr("forum");
		$.get('/hezi/forum?forum='+theforum+'&action=delete',function(theback)
			  {
				consolelog(theback);
			  }
		);
	});
	
	
	
})




					
</script>

<style>
.forumnum{
	width:30px;
	text-align:center;
}
.forumselected{
	background:#1abc9c;
	color:#FFF;
	border:#FFF 1px solid;
}

#forumsdiv{
	width:100%; 
}

#forumstable{
	width:80%; 
	vertical-align:top;
}

#forumstable td{
	padding:4px;
	font-size:14px;
}


.groupaction{
	//float:right;
	display:none;
}
.grouptd{
	height:30px;
	vertical-align:top;
}

.groupname{
	font-size:20px; 
	color:#CCC; 
	font-weight:800; 
}
.forumtable{
	width:200px;
	margin:6px;
	margin-left:20px;
	border:#eceff1 1px solid; 
	float:left; 
	font-size:14px;
}

.forumtable td{
	padding:4px;
	height:28px;
	//vertical-align:top;
}


.forumnewimagecount{
	background-color:#eceff1;
	padding-top:4px;
	width:36px; 
	text-align:center; 
	vertical-align:middle; 
	color:#1abc9c; 
}

.groupnewimagecount{
	padding-left:10px;
	color:#999;
}

.forumidtd{
	width:60px; 
	padding-left:10px; 
	padding:4px;
	text-align:right;
}

.forumnametd{
	//width:80px; 
}

.actiontd{
	display:none; 
	//background-color:#eceff1; 
}




.logindiv{
	 position:absolute; 
	 width:210px;
	 text-align:center;
	 border:#eee 4px solid; 
	 padding:10px 10px; 
	 display:none; 
	 background-color:#FFF;
	 z-index:9999;
}

.logintable{
	margin-top:10px;
}

.forumoperation{
	color:#09C;
	font-size:14px;
	text-decoration:none;
	cursor:pointer;
}

</style>

</html>
